﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuickModel.Demo
{
	public class UseRespondHanlder : IResponseHanlder
	{
		public void AddStartTime(DateTime inputDataTime)
		{
			this.startTime = inputDataTime;
		}

		public void AddEndTime(DateTime inputDataTime)
		{
			this.endTime = inputDataTime;
		}

		public void AddOneResponse(RevitModelRebuildResponse inputResponse)
		{
			this.lstResponse.Add(inputResponse);
		}

		public void HanlderResponse()
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = (from n in this.lstResponse
			where n.IfSucess
			select n).Count<RevitModelRebuildResponse>();
			stringBuilder.AppendLine(string.Format("共翻成功{0}个", num));
			stringBuilder.AppendLine(string.Format("共耗时{0}", (this.endTime - this.startTime).ToString()));
			MessageBox.Show(stringBuilder.ToString());
			this.lstResponse = new List<RevitModelRebuildResponse>();
		}

		private DateTime startTime;

		private DateTime endTime;

		private List<RevitModelRebuildResponse> lstResponse = new List<RevitModelRebuildResponse>();
	}
}
